BigDFT.Fragments module

This module contains data structures for describing fragments. Fragments are orders lists of atoms.

distance(i, j, cell=None)[source]

Distance between fragments, defined as distance between center of mass

Parameters
  • i (Fragment) – first fragment.

  • j (Fragment) – second fragment.

  • cell (array) – an array describing the unit cell.

Returns

the distance between centers of mass.

Return type

(float)

pairwise_distance(i, j, cell=None)[source]

Distance between fragments, as defined by the distance between their two nearest atoms.

Parameters
  • i (Fragment) – first fragment.

  • j (Fragment) – second fragment.

  • cell (array) – an array describing the unit cell.

Returns

the pairwise distance between fragments.

Return type

(float)

lineup_fragment(frag)[source]

Align the principal axis of inertia of the fragments along the coordinate axis. Also shift the fragment such as its centroid is zero.

Parameters

(BigDFT.Fragments.Fragment) – the fragment to transform.

Returns

the transformed fragment.

Return type

(BigDFT.Fragments.Fragment)

class RotoTranslation(frag1, frag2)[source]

Define a transformation which can be applied to a fragment. This rotation is defined by giving this class two fragments, and the rototranslation between those fragments is automatically computed.

Parameters
dot(frag)[source]

Apply the rototranslations on a fragment.

Parameters

frag (BigDFT.Fragments.Fragment) – the fragment to rototranslate.

Returns

the rototranslated fragment.

Return type

(BigDFT.Fragments.Fragment)

invert()[source]

Computes the inverse rototranslation.

class Translation(t)[source]

This class defines a simple translation.

Parameters

t (list) – the vector describing the translation.

class Rotation(R)[source]

This class defines a simple rotation.

Parameters

t (list) – the vector describing the rotation.

interpolate_fragments(A, B, steps, extrapolation_steps=0)[source]

Given two fragments A and B, this generates a list of Fragments that interpolate between A and B in a specified number of steps.

Parameters
Returns

a list of fragments interpolating between A and B including A and B.

Return type

(list)

class Fragment(atomlist=None, xyzfile=None, posinp=None, astruct=None, system=None)[source]

A fragment is a list of atoms in a system. Fragment might have quantities associated to it, like its electrostatic multipoles (charge, dipole, etc.) and also geometrical information (center of mass, principla axis etc.). A Fragment might also be rototranslated and combined with other moieteies to form a BigDFT.Systems.Systems.

Parameters
  • atomlist (list) – list of atomic dictionaries defining the fragment

  • xyzfile (BigDFT.IO.XYZReader) – an XYZ file to read from.

  • posinp (dict) – the posinp style dictionary from a logfile/input file.

  • astruct (dict) – a BigDFT atomic structure style dictionary.

  • system (BigDFT.Systems.System) – a BigDFT system, esssentially this reduces many fragments into a single fragment.

Todo

Define and describe if this API is also suitable for solid-state fragments

serialize(name, units='bohr')[source]

Transform the fragment in a list that can be employed for the construction of dataframes or pandas series.

Parameters
  • name (str) – the name of the fragment

  • units (str) – the units for the positions

Returns

the serialized fragment

Return type

list

property centroid

The center of a fragment.

center_of_charge()[source]

The charge center which depends both on the position and net charge of each atom.

property q0

Provides the global monopole of the fragments given as a sum of the monopoles of the atoms.

d0(center=None)[source]

Fragment dipole, calculated only from the atomic charges.

Parameters

center (list) – the center of charge of the fragment. If this is not present, the centroid is used.

d1(center=None)[source]

Fragment dipole including the atomic dipoles.

Parameters

center (list) – the center of charge of the fragment. If this is not present, the centroid is used.

ellipsoid(center=0.0)[source]

Todo: define the ellipsoid.

get_external_potential(units='bohr', charge_offset=False)[source]

Transform the fragment information into a dictionary ready to be put as an external potential.

Parameters

units (str) – the units of the external potential.

Returns

a dictionary describing the external potential for use in an input file.

Return type

(dict)

get_net_force()[source]

Returns the net force on a fragment in Ha/Bohr.

Returns

(list) Three values which describe the net force.

qcharge()[source]

The net charge on a fragment.

property nel

The number of valence electrons of the atoms of the fragment

rotate_on_axis(angle, axis, units='radians')[source]

Rotate a fragment along a specific axis.

Parameters
  • angle (float) – angle to rotate along the axis.

  • axis (list) – a list of floats defining the vector to rotate along.

  • units (str) – either radians or degrees.

rotate(x=None, y=None, z=None, units='radians')[source]

Rotate the fragment.

Parameters
  • x (float) – angle to rotate on the x axis.

  • y (float) – angle to rotate on the y axis.

  • z (float) – angle to rotate on the z axis.

  • units (str) – either radians or degrees.

translate(vec)[source]

Translate the fragment along the vector provided.

Parameters

vec (list) – a list of x, y, z values describing the translation (AU).

rmsd(reference)[source]

Calculate the Reduced Mean Square displacement with a reference fragment.